#!/bin/bash

source='/home/ccls/tmp/qwatcher'

inotifywait -qmr --exclude $source/build -e modify --format '%w%f' $source |
while read FILE
do
    # 检查父进程是否还存在
    if ! ps -p $$ > /dev/null; then
      echo "Parent process has died. Exiting..."
      exit 0
    fi
    echo "$FILE"
done

